package javaer.starter.core.generator;

import freemarker.template.TemplateException;
import javaer.starter.core.BuildContext;
import javaer.starter.core.handler.DynamicTemplateHandler;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.io.IOException;

/**
 * @author yangzhen
 * @date 2021/11/18 16:59
 * @since 1.0.0
 */
@Component
public class StarterGenerator implements IGenerator {

    @Resource
    private DynamicTemplateHandler dynamicTemplateHandler;

    @Override
    public void generate(BuildContext buildContext) throws TemplateException, IOException {
            dynamicTemplateHandler.handle(initModuleContext(buildContext, buildContext.getStarterModule()));
    }
}
